package com.airsystem.pos.bengkel.model;

import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;

import com.airsystem.pos.bengkel.component.DesktopFrame;
import com.airsystem.pos.bengkel.entity.wrapper.OrderLayananWrapper;
import com.airsystem.pos.bengkel.interfaces.IComboState;
import com.toedter.calendar.JDateChooser;

/**
 * @author Budi Oktaviyan <budi.oktaviyan@icloud.com>
 */
public class ServiceOrderModel extends DesktopFrame {
	protected int row = 0;

	protected IComboState comboState;

	protected boolean isGridClicked = false;

	protected GridBagLayout baseLayout = new GridBagLayout();
	protected GridBagLayout panelLayout = new GridBagLayout();

	protected JScrollPane scrollPane = new JScrollPane();
	protected JScrollPane tableserviceScroll = new JScrollPane();

	protected JPanel basePanel = new JPanel();
	protected JPanel buttonPanel = new JPanel();
	protected JPanel fieldPanel = new JPanel();

	protected JLabel tanggalLabel = new JLabel();
	protected JLabel namaLabel = new JLabel();
	protected JLabel kendaraanLabel = new JLabel();
	protected JLabel nopolLabel = new JLabel();
	protected JLabel serviceLabel = new JLabel();
	protected JLabel sparepartLabel = new JLabel();
	protected JLabel sparepartUsedLabel = new JLabel();
	protected JLabel hargaLabel = new JLabel();
	protected JLabel kilometerLabel = new JLabel();
	protected JLabel metodeLabel = new JLabel();
	protected JLabel totalLabel = new JLabel();

	protected JDateChooser tanggalChooser = new JDateChooser();

	protected JComboBox namaCombo = new JComboBox();
	protected JComboBox kendaraanCombo = new JComboBox();
	protected JComboBox serviceCombo = new JComboBox();
	protected JComboBox sparepartCombo = new JComboBox();
	protected JComboBox pembayaranCombo = new JComboBox();

	protected JTextField nopolField = new JTextField();
	protected JTextField sparepartUsedField = new JTextField();
	protected JTextField hargaField = new JTextField();
	protected JTextField kilometerField = new JTextField();
	protected JTextField totalField = new JTextField();
	protected JTextField idField = new JTextField();

	protected JButton searchButton = new JButton();
	protected JButton addButton = new JButton();
	protected JButton submitButton = new JButton();
	protected JButton updateButton = new JButton();
	protected JButton deleteButton = new JButton();
	protected JButton cancelButton = new JButton();

	protected OrderLayananWrapper selectedSearchOrderLayanan;

	protected JTable tableServices = new JTable();

	protected static final String[] COMBOS = { "TUNAI", "HUTANG 1 MINGGU", "HUTANG 2 MINGGU",
											   "HUTANG 3 MINGGU", "HUTANG 4 MINGGU" };

	protected static final String[] COLUMNS = { "Kendaraan", "Sparepart", "Jenis Layanan",
												"Harga", "Pembayaran", "ID" };

	protected final DefaultTableModel tableModel = new DefaultTableModel(new Object[][] {}, COLUMNS) {
		final boolean[] canEdit = new boolean[] { false, false, false,
												  false, false, false };

		public boolean isCellEditable(int rowIndex, int columnIndex) {
			return canEdit[columnIndex];
		}
	};

	public ServiceOrderModel() {
		super();
	}
}